#include <stdio.h>
#include <string.h>
#include <stdbool.h>

char upper(char c){
	if(c <= 'z' && c >= 'a'){
		c -= 32;
	}
	return c;
}
int main()
{
	char input[10000] = {0}, bad[70] = {0};
	bool lowFlag = false;
	unsigned int i = 0, j = 0;
	//输入
	scanf("%s", &bad);
	scanf("%s", &input);

	//检查是否包含'+'
	for(i = 0; i < strlen(bad); i++){
		if(bad[i] == '+'){
			lowFlag = true;
		}
	}

	i = 0;
	while(i < strlen(input)){
		//如果坏掉的按键包含'+' 则无法输出大写字母
		if(lowFlag && input[i] <= 'Z' && input[i] >= 'A'){
			i++;
			continue;
		}
		//和错键挨个比较，需要讲a-z转换成大写字母再比较
		for(j = 0; j < strlen(bad); j++){
			char temp = upper(input[i]);
			if(temp == bad[j]){
				i++;
				goto point;
			}
		}
		printf("%c", input[i]);
		i++;
point:;
	}
	printf("\n");
	return 0;
}
